package com.zeta.eduservice.controller;


import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.zeta.commonutils.R;
import com.zeta.eduservice.service.EduStatisticsDailyService;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author zeta
 * @since 2020-08-18
 */
@CrossOrigin
@RestController
@RequestMapping("/statistics/edu-statistics_daily")
public class EduStatisticsDailyController {

	
	@Autowired
	EduStatisticsDailyService dailyService;

    //统计某一天注册人数,生成统计数据
    @PostMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day) {
    	dailyService.registerCount(day);
        return R.ok();
    }

    //图表显示，返回两部分数据，日期json数组，数量json数组
    @GetMapping("showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type,@PathVariable String begin,
                      @PathVariable String end) {
        Map<String,Object> map = dailyService.getShowData(type,begin,end);
        return R.ok().data(map);
    }
}

